/*
 * @Author: qiulin_JXGM ql1746365080@gmail.com
 * @Date: 2024-09-02 14:38:15
 * @LastEditors: qiulin_JXGM ql1746365080@gmail.com
 * @LastEditTime: 2024-09-02 16:25:50
 * @FilePath: \SGFEM\DataStructure\FEM\Property\src\PBEAMData.cpp
 */
#include "DataStructure/Input/Property/PBEAMData.h"

#include <cstddef>

#include "DataStructure/Common/Validation.h"

bool SG::DataStructure::FEM::PBEAMData::Check () const
{
    if (m_A[0] < 1.0e-6)
    {
        return false;
    }

    if (m_I1[0] < 1.0e-6)
    {
        return false;
    }

    if (m_I2[0] < 1.0e-6)
    {
        return false;
    }

    return true;
}

bool SG::DataStructure::FEM::operator== (const PBEAMData& a, const PBEAMData& b)
{
    if (a.m_mId != b.m_mId)
    {
        return false;
    }
    if (a.m_nsges != b.m_nsges)
    {
        return false;
    }
    if (a.m_ccf != b.m_ccf)
    {
        return false;
    }
    if (a.m_cweld != b.m_cweld)
    {
        return false;
    }
    for (size_t i = 0; i < 11; ++i)
    {
        if (!SG::DataStructure::Common::isNear (a.m_SO[i], b.m_SO[i]))
        {
            return false;
        }
        if (!SG::DataStructure::Common::isNear (a.m_XXB[i], b.m_XXB[i]))
        {
            return false;
        }
        if (!SG::DataStructure::Common::isNear (a.m_A[i], b.m_A[i]))
        {
            return false;
        }
        if (!SG::DataStructure::Common::isNear (a.m_I1[i], b.m_I1[i]))
        {
            return false;
        }
        if (!SG::DataStructure::Common::isNear (a.m_I2[i], b.m_I2[i]))
        {
            return false;
        }
        if (!SG::DataStructure::Common::isNear (a.m_I12[i], b.m_I12[i]))
        {
            return false;
        }
        if (!SG::DataStructure::Common::isNear (a.m_J[i], b.m_J[i]))
        {
            return false;
        }
        if (!SG::DataStructure::Common::isNear (a.m_NSM[i], b.m_NSM[i]))
        {
            return false;
        }
        if (!SG::DataStructure::Common::isNear (a.m_C1[i], b.m_C1[i]))
        {
            return false;
        }
        if (!SG::DataStructure::Common::isNear (a.m_C2[i], b.m_C2[i]))
        {
            return false;
        }
        if (!SG::DataStructure::Common::isNear (a.m_D1[i], b.m_D1[i]))
        {
            return false;
        }
        if (!SG::DataStructure::Common::isNear (a.m_D2[i], b.m_D2[i]))
        {
            return false;
        }
        if (!SG::DataStructure::Common::isNear (a.m_E1[i], b.m_E1[i]))
        {
            return false;
        }
        if (!SG::DataStructure::Common::isNear (a.m_E2[i], b.m_E2[i]))
        {
            return false;
        }
        if (!SG::DataStructure::Common::isNear (a.m_F1[i], b.m_F1[i]))
        {
            return false;
        }
        if (!SG::DataStructure::Common::isNear (a.m_F2[i], b.m_F2[i]))
        {
            return false;
        }
    }
    if (!SG::DataStructure::Common::isNear (a.m_K1, b.m_K1))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_K2, b.m_K2))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_S1, b.m_S1))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_S2, b.m_S2))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_NSIA, b.m_NSIA))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_NSIB, b.m_NSIB))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_CWA, b.m_CWA))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_CWB, b.m_CWB))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_M1A, b.m_M1A))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_M2A, b.m_M2A))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_M1B, b.m_M1B))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_M2B, b.m_M2B))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_N1A, b.m_N1A))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_N2A, b.m_N2A))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_N1B, b.m_N1B))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (a.m_N2B, b.m_N2B))
    {
        return false;
    }
    if (a.m_domainId != b.m_domainId)
    {
        return false;
    }
    return true;
}